
//
//  PMineResumeCredentInfoModel.m
//  Btpin
//
//  Created by Vic on 2019/3/24.
//  Copyright © 2019 Vic. All rights reserved.
//

#import "PMineResumeCredentInfoModel.h"

@implementation PMineResumeCredentInfoModel

- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues {
    self.info_id = [UIToolsControl dataAnalysis:keyedValues[@"info_id"]];
    self.recieve_date = [UIToolsControl dataAnalysis:keyedValues[@"recieve_date"]];
    self.name = [UIToolsControl dataAnalysis:keyedValues[@"name"]];
    self.has_img = [UIToolsControl dataAnalysis:keyedValues[@"has_img"]];
    self.img = [UIToolsControl dataAnalysis:keyedValues[@"img"]];
    
    self.images = @"";
    self.imagesArray = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"images"]) {
        if ([keyedValues[@"images"] isKindOfClass:[NSArray class]]) {
            if (keyedValues[@"images"] && [keyedValues[@"images"] count]) {
                for (NSDictionary *dic in keyedValues[@"images"]) {
                    ImageModel *model = [[ImageModel alloc] init];
                    [model setValuesForKeysWithDictionary:dic];
                    [self.imagesArray addObject:model];
                }
            }
        } else if ([keyedValues[@"images"] isKindOfClass:[NSString class]]) {
            self.images = [UIToolsControl dataAnalysis:keyedValues[@"images"]];
        }
    }
    
    self.imgs = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"imgs"] && [keyedValues[@"imgs"] count]) {
        for (NSString *str in keyedValues[@"imgs"]) {
            [self.imgs addObject:str];
        }
    }
    
    CGFloat imgHeight = 0;
    self.img = [UIToolsControl dataAnalysis:keyedValues[@"img"]];
    if (self.img && self.img.length) {
        imgHeight = 80*Scale;
    }
    
    self.allHeightOfCompanyLook = 45*Scale+imgHeight;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
}

- (id)copyWithZone:(NSZone *)zone {
    PMineResumeCredentInfoModel *model = [[[self class] allocWithZone:zone] init];
    model.info_id = self.info_id;
    model.recieve_date = self.recieve_date;
    model.name = self.name;
    model.has_img = self.has_img;
    model.img = self.img;
    model.allHeightOfCompanyLook = self.allHeightOfCompanyLook;
    
    model.imagesArray = [NSMutableArray arrayWithCapacity:0];
    if (self.imagesArray && self.imagesArray.count) {
        for (ImageModel *tempModel in self.imagesArray) {
            [model.imagesArray addObject:[tempModel copy]];
        }
    }
    
    model.imgs = [NSMutableArray arrayWithCapacity:0];
    if (self.imgs && self.imgs.count) {
        [model.imgs addObjectsFromArray:self.imgs];
    }
    
    return model;
}

@end
